<template>
  <ZEcharts :options="options" />
</template>


<script>
import { cloneDeep, set } from 'lodash'
import ZEcharts from '@/components/storybook/z-echarts'

export default {
  name: 'Chart',

  components: {
    ZEcharts,
  },
  props: {
    view: {
      type: Object,
      default: () => ({})
    },
    dataset: {
      type: Array,
      default: () => ([])
    },
  },
  computed: {
    options () {
      const { name, ...options } = cloneDeep(this.view)
      set(options, 'dataset.source', this.dataset)
      return options
    }
  }
}
</script>
